Skip to content

Make isValidEmail callable from commonMain - #3368

Closed
StylianosGakis wants to merge 1 commit into
developfrom
refactor/common-email-validation
Closed

StylianosGakis wants to merge 1 commit into
developfrom
refactor/common-email-validation

Conversation

@StylianosGakis

Copy link
Copy Markdown
Member
🤖 AI description

Makes isValidEmail callable from commonMain in core-common-public. Three features validate emails in presenter code that is about to move to commonMain (insurance certificate, travel certificate, login), and the only validator was Android-only because it uses PatternsCompat.

On Android nothing changes: the existing function just gains the actual keyword. JVM and iOS match against the same pattern string, copied verbatim from PatternsCompat.EMAIL_ADDRESS in androidx.core 1.19.1, so every target accepts exactly the same addresses. The test runs the same cases on the JVM and on the iOS simulator, since Kotlin/Native has its own regex engine.

No caller changes here.

isValidEmail becomes an expect in commonMain of :core-common-public. The
Android actual keeps its PatternsCompat body. The JVM and native actuals
full-match a Regex built from the PatternsCompat.EMAIL_ADDRESS pattern string,
copied from androidx.core 1.19.1 sources and held once in commonMain. The new
commonTest runs on JVM and the iOS simulator.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant